package com.ss.ttvideoengine.log;

import com.ss.ttvideoengine.d.TTVideoEngineLog;

import org.json.JSONArray;
import org.json.JSONObject;

public enum VideoEventManager {
    instance;

    private static final String TAG = "VideoEventManager";
    private JSONArray mJsonArray;
    private IVideoEventExecutor mListener;

    private VideoEventManager() {
        this.mListener = null;
        this.mJsonArray = new JSONArray();
    }

    protected final void addEvent(JSONObject arg4) {
        Class v1 = VideoEventManager.class;
        synchronized (v1) {
            if (arg4 == null) {
                return;
            } else {
                TTVideoEngineLog.log("VideoEventManager", arg4.toString());
                this.mJsonArray.put(arg4);
                if (this.mListener != null) {
                    this.mListener.execute();
                }
            }
        }
    }

    public final JSONArray popAllEvents() {
        JSONArray v0 = this.mJsonArray;
        Class v1 = VideoEventManager.class;
        synchronized (v1) {
            this.mJsonArray = new JSONArray();
            return v0;
        }
    }

    public final void setListener(IVideoEventExecutor arg1) {
        this.mListener = arg1;
    }
}

